package cn.trigram.mgb.plugins;

import java.util.List;
import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.PluginAdapter;
import org.mybatis.generator.api.dom.java.FullyQualifiedJavaType;
import org.mybatis.generator.api.dom.java.Interface;

/**
 * 生成Mapper注解
 */
public class MapperAnnotationPlugin extends PluginAdapter {

  @Override
  public boolean validate(List<String> warnings) {

    return true;
  }

  @Override
  public boolean clientGenerated(
      Interface interfaze, IntrospectedTable introspectedTable
  ) {

    interfaze.addImportedType(
        new FullyQualifiedJavaType("org.apache.ibatis.annotations.Mapper")); //$NON-NLS-1$
    interfaze.addAnnotation("@Mapper"); //$NON-NLS-1$
    return true;
  }

}
